using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebForum.App_Data;
using BaseForum.Model;

namespace WebForum
{
    public partial class DoctorForum : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //User testUser = UserDataSource.Get(1);
            //Session["user"] = testUser;
            if (!IsPostBack)
            {
                int onlineUsers = (int)Application["ActiveUsers"];
                LabelUserOnlines.Text += onlineUsers.ToString();
                LabelRegistedUser.Text += UserDataSource.Count();
                if (Session["user"] != null)
                {
                    User u = (User)Session["user"];
                    PanelStatus.Visible = true;
                    LinkButtonUserInfo.Text += "Hello " + u.UserName;
                    if (User.UserAdmin == u.Type)
                    {
                        Li1.Visible = true;
                        Li2.Visible = true;
                    }
                }
            }
        }
        /// <summary>
        /// Logout
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void LinkButtonLogout_Click(object sender, EventArgs e)
        {
            Session.Abandon();
            Response.Redirect("Home.aspx");
        }
        //Show private info
        protected void LinkButtonUserInfo_Click(object sender, EventArgs e)
        {
            Response.Redirect("UserInfo.aspx");
        }
    }
}
